/**
 * @(#)ProApplicationStartedListener.java
 * Description: 启动监听
 * Version :    0.0.0
 * Copyright:   Copyright (c)
 * Create by:   w15579  2017年9月26日
 */
package com.zn.kjj.util.listener;

import org.springframework.boot.context.event.ApplicationStartingEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.ClassUtils;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;


/**
 * @ClassName: ProApplicationStartedListener
 * @Description: 启动监听
 * @author w15579
 * @date. 2017年9月26日
 * @version v1.0.0
 */
public class PreApplicationStartingEventListener implements ApplicationListener<ApplicationStartingEvent> {

    /* (non-Javadoc)
     * @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
     */
    @Override
    public void onApplicationEvent(ApplicationStartingEvent arg0) {
        System.out.println("开始启动");
        ClassPathResource basePatha = null;// 类根路径
        String strPath = "";
        String basePatha1 = ClassUtils.getDefaultClassLoader().getResource("").getPath();
        try {
            basePatha1 = URLDecoder.decode(basePatha1, "utf-8");
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }
        System.out.println(basePatha1);

    }


}
